package ufabc.edu.helppo.rpc.command;

import static ufabc.edu.helppo.rpc.RPCOpenSimParameters.SERVER_URL_RPC;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ResourceBundle;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

import ufabc.edu.helppo.gerador.exceptions.NenhumEspacoDisponivelException;
import ufabc.edu.helppo.rpc.singleton.HelppoProperties;

public abstract class RPCCommand {

	public abstract boolean execute() throws MalformedURLException,
			XmlRpcException, IOException, NenhumEspacoDisponivelException;

	public void configure(XmlRpcClient client_) throws IOException {

		ResourceBundle properties = HelppoProperties.getInstance();
		XmlRpcClientConfigImpl configImpl = new XmlRpcClientConfigImpl();
		configImpl.setServerURL(new URL(properties.getString(SERVER_URL_RPC)));
		

		client_.setConfig(configImpl);

	}
}
